﻿<m:EntityBase
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:Signum.Windows"
    x:Class="Signum.Windows.EntityCombo"
    x:Name="me" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="332.993" Style="{DynamicResource toolTip}">
	<m:EntityBase.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../Resources.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</m:EntityBase.Resources>

	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>
		<Label Content="{Binding Path=LabelText, ElementName=me, Mode=Default}" VerticalContentAlignment="Center" HorizontalAlignment="Left" 
		Target="{Binding ElementName=combo, Mode=OneWay}" MinWidth="{Binding Path=(m:Common.MinLabelWidth), ElementName=me, Mode=OneWay}"
		 Visibility="{Binding ElementName=me, Path=(m:Common.LabelVisible), Converter={x:Static m:Converters.BoolToVisibility}}"
		/>
		<ComboBox Grid.ColumnSpan="1" Grid.Column="1" Margin="1,1,1,1" Background="{DynamicResource BlueBackground}"  x:Name="combo" 
		ItemTemplate="{Binding Path=EntityTemplate, ElementName=me, Mode=Default}" SelectionChanged="combo_SelectionChanged"
        IsEnabled="{Binding Path=(m:Common.IsReadOnly), ElementName=me, Converter={x:Static m:Converters.Not}}" PreviewKeyDown="combo_PreviewKeyDown" />
		<StackPanel Orientation="Horizontal" Grid.Column="2" x:Name="buttons">
			<Button Focusable="False" x:Name="btCreate" Click="btCreate_Click" Style="{StaticResource RoundButton}" Content="{StaticResource Create}" ToolTip="{m:Loc Create}"/>
			<Button Focusable="False" x:Name="btFind" Click="btFind_Click" Style="{StaticResource RoundButton}" Content="{StaticResource Find}" ToolTip="{m:Loc Find}"/>
			<Button Focusable="False" x:Name="btView" Style="{StaticResource RoundButton}" Click="btView_Click" Content="{StaticResource View}" ToolTip="{m:Loc View}"/> 
			<Button Focusable="False" x:Name="btRemove" Style="{StaticResource RoundButton}" Click="btRemove_Click" Content="{StaticResource Remove}" ToolTip="{m:Loc Remove}"/>
		</StackPanel>
	</Grid>

</m:EntityBase>
